;;;
;;;
;;;	Author:
;;;		Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;
;;;	http://www.paracadd.com
;;;	All rights reserved.
;;;
(defun c:tblk ()
  (vl-load-com)
  (setq ss (ssget "x" '((-4 . "<and")
                          (-4 . "<not")(2 . "GST00X01")(-4 . "not>")
                          (-4 . "<not")(2 . "CSTECX01")(-4 . "not>")
                          (-4 . "<not")(2 . "CSTNWX01")(-4 . "not>")
                          (-4 . "<not")(2 . "CGPXNX01")(-4 . "not>")
                          (-4 . "<not")(2 . "CGP00X01")(-4 . "not>")
                          (-4 . "<not")(2 . "REH_PE")(-4 . "not>")
                          (-4 . "<not")
                            (-4 . "<and")
                              (2 . "NA1")
                              (8 . "*vi02*")
                            (-4 . "and>")
                          (-4 . "not>")
                          (-4 . "<not")
                            (-4 . "<and")
                              (2 . "NA2")
                              (8 . "*vi02*")
                            (-4 . "and>")
                          (-4 . "not>")
                          (-4 . "<not")(1 . "SHT C-*")(-4 . "not>")
                          (-4 . "<not")(2 . "GTP00001")(-4 . "not>")
                          (-4 . "<not")(2 . "CGP00X01")(-4 . "not>")
                          (-4 . "<not")(8 . "C?VI031*")(-4 . "not>")
                          (-4 . "<not")(8 . "C?VI01*")(-4 . "not>")
                          (-4 . "<not")(8 . "C-VI02?NPLT")(-4 . "not>")
                          (-4 . "<not")(8 . "*KEYM")(-4 . "not>")
                          (-4 . "<not")
                            (-4 . "<and")
                              (0 . "VIEWPORT")
                              (8 . "*vi02*")
                            (-4 . "and>")
                          (-4 . "not>")
                          (-4 . "<not")
                            (-4 . "<and")
                              (0 . "VIEWPORT")
                              (8 . "*vi01*")
                            (-4 . "and>")
                          (-4 . "not>")
                        (-4 . "and>")
                       )
           )
  )
  (vla-put-MSpace (vla-get-Activedocument (vlax-get-Acad-Object)) :vlax-true)
;;;  (command ".mspace")
  (if (findfile (strcat(substr (getvar"dwgname")(-(strlen(getvar"dwgname"))2))".dwg"))
    (command ".wblock" (substr (getvar"dwgname")(-(strlen(getvar"dwgname"))2)) "Y" "" "0,0" ss "")
    (command ".wblock" (substr (getvar"dwgname")(-(strlen(getvar"dwgname"))2)) "" "0,0" ss "")
  )
  (vla-put-MSpace (vla-get-Activedocument (vlax-get-Acad-Object)) :vlax-false)
;;;  (command ".pspace")
  (setq oldvp (ssget "x" '((-4 . "<and")
;                             (-4 . "<and")
                               (0 . "VIEWPORT")
                               (8 . "*VI03*")
;                             (-4 . "and>")
;                             (-4 . "<and")
;                               (0 . "TEXT")
;                               (1 . "1\" = 3000'")
;                             (-4 . "and>")
                           (-4 . "and>")

                          )
              )
  )
  (command ".erase" oldvp "")
)